<?php
declare (strict_types = 1);

namespace app\common\model;

use think\facade\Event;
class PaperBank extends Base
{

    protected $name = 'paper_bank';

    public function getCateTextAttr($value, $data)
    {
        return Cate::where('id', $data['cate'])->value('title') ?? "";
    }
    public function getTypesTextAttr($value, $data)
    {
        return self::getTypesList($data['types'], 1);
    }
    public static function getTypesList($value, $type = 1)
    {
        $list = [1 => '单选', 2 => '多选'];
        return $type == 1 ? $list[$value] : $list;
    }
    
    public function getTitleTextAttr($value, $data)
    {
        return Exam::where('id', $data['exam_id'])->value('title') ?? "";
    }
    
}
